home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / fontutil.6 / fontutil / fontutils-0.6 / include / encoding.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-03  |  3.0 KB  |  84 lines

  1. /* encoding.h: parse a font encoding (.enc) file.
  2.  
  3. Copyright (C) 1992 Free Software Foundation, Inc.
  4.  
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9.  
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18.  
  19. #ifndef ENCODING_H
  20. #define ENCODING_H
  21.  
  22. #include "font.h"
  23. #include "list.h"
  24. #include "types.h"
  25.  
  26. /* A single character from the encoding file.  Since we usually want to
  27.    deal with the entire collection of characters as a group, we don't
  28.    define any accessor macros for this structure, but rather the next.  */
  29. typedef struct
  30. {
  31.   string name;
  32.   list_type ligature;
  33. } encoding_char_type;
  34.  
  35. /* The size of font's encoding vector (PostScript defines this).  */
  36. #define ENCODING_VECTOR_SIZE  256
  37.  
  38. /* The collection of all the information from the file.  */
  39. typedef struct
  40. {
  41.   string coding_scheme;
  42.   encoding_char_type encoding_char[ENCODING_VECTOR_SIZE];
  43. } encoding_info_type;
  44.  
  45. /* The name of the encoding scheme in E_I.  */
  46. #define ENCODING_SCHEME_NAME(e_i) ((e_i).coding_scheme)
  47.  
  48. /* The Nth encoding character in E_I.  */
  49. #define ENCODING_CHAR_ELT(e_i, n) ((e_i).encoding_char[n])
  50.  
  51. /* The name of the character CODE in the encoding structure E_I, or NULL
  52.    if the character doesn't exist.  */
  53. #define ENCODING_CHAR_NAME(e_i, code) (ENCODING_CHAR_ELT (e_i, code).name)
  54.  
  55. /* The ligature table for the character code in the encoding structure
  56.    E_I.  Each element of the list is a pointer to a `tfm_ligature_type'.
  57.    The list is garbage if the character doesn't exist.  */
  58. #define ENCODING_CHAR_LIG(e_i, code) (ENCODING_CHAR_ELT (e_i, code).ligature)
  59.  
  60.  
  61. /* If an encoding file is mandatory for a program to operate, and the
  62.    user does not specify one, the program should use this.  */
  63. #define DEFAULT_ENCODING "ascii"
  64.  
  65. /* Returns the character code for the character named NAME in E_I, or -1
  66.    if NAME is not present or NULL.  */
  67. extern int encoding_number (encoding_info_type e_i, string name);
  68.  
  69.  
  70. /* Return the basename for the encoding file in which the encoding 
  71.    CODINGSCHEME can be found.  Reads the library file (see `libfile.h')
  72.    `encoding.map'.  Case is ignored in the comparison with
  73.    CODINGSCHEME.  If CODINGSCHEME is not present in `encoding.map',
  74.    issue a warning and return some default.  */
  75. extern string coding_scheme_to_filename (string codingscheme);
  76.  
  77.  
  78. /* Read the library file (see `libfile.h') `FILENAME.enc', and return
  79.    the information it contains.  If the file cannot be opened, give a
  80.    fatal error.  */
  81. extern encoding_info_type read_encoding_file (string filename);
  82.  
  83. #endif /* not ENCODING_H */
  84.